<?php


namespace App\Utils\Notice;


use App\Model\NoticeUser;
use Hyperf\DbConnection\Model\Model;

class UserWithdrawReject extends Notice
{
    public $messageTemplate = '很抱歉，因为系统原因，您的提现申请被驳回，请重新提现。';

    //前端路由-个人中心
    public $routeName = '/pages/wallet/withdrawalRecord?type=1';

    function toDatabase()
    {
        $data = $this->format($this->data);
        /** @var Model $model */
        $model = new NoticeUser();
        $model->fill($data)->save();
    }

    public function format($data)
    {
        $return = [
            'user_id' => $this->receiverId,
            'content' => $this->messageTemplate,
            'type' => \App\Constants\Model\Notice::USER_WITHDRAW_REJECT,
            'extension' => [
                'path' => $this->routeName . $this->receiverId
            ]
        ];
        return $return;

    }

}